package com.powerbank.financecenter.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.powerbank.common.dto.AccountDTO;
import com.powerbank.common.dto.TransactionRequest;
import com.powerbank.common.dto.WithdrawalRequest;
import com.powerbank.common.result.Result;
import com.powerbank.financecenter.entity.UserAccount;

import java.math.BigDecimal;
import java.util.List;

/**
 * 用户账户服务接口
 */
public interface UserAccountService extends IService<UserAccount> {

    /**
     * 创建用户账户
     */
    Result<AccountDTO> createAccount(Long userId, String accountType);

    /**
     * 根据用户ID和账户类型查询账户
     */
    Result<AccountDTO> getAccountByUserIdAndType(Long userId, String accountType);

    /**
     * 查询用户所有账户
     */
    Result<List<AccountDTO>> getUserAccounts(Long userId);

    /**
     * 充值
     */
    Result<String> recharge(TransactionRequest request);

    /**
     * 消费
     */
    Result<String> consume(TransactionRequest request);

    /**
     * 退款
     */
    Result<String> refund(TransactionRequest request);

    /**
     * 冻结金额
     */
    Result<Void> freezeAmount(Long accountId, BigDecimal amount);

    /**
     * 解冻金额
     */
    Result<Void> unfreezeAmount(Long accountId, BigDecimal amount);

    /**
     * 提现申请
     */
    Result<String> applyWithdrawal(WithdrawalRequest request);

    /**
     * 处理提现
     */
    Result<Void> processWithdrawal(String withdrawalNo, String status, String remark);

    /**
     * 查询账户余额
     */
    Result<BigDecimal> getAccountBalance(Long accountId);

    /**
     * 更新账户状态
     */
    Result<Void> updateAccountStatus(Long accountId, String status);

    /**
     * 获取账户统计信息
     */
    Result<Object> getAccountStatistics();
}